package com.paypal.android.a;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Build.VERSION;
import android.telephony.TelephonyManager;
import com.paypal.android.MEP.PayPalActivity;
import com.paypal.android.MEP.j;
import com.paypal.android.MEP.l;
import com.paypal.android.MEP.m;
import com.paypal.android.a.a.b;
import com.paypal.android.a.a.d;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Vector;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import junit.framework.Assert;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public final class o
{
  private static String[] a = { "+1", "+27", "+30", "+31", "+32", "+33", "+34", "+36", "+39", "+41", "+43", "+44", "+45", "+46", "+47", "+48", "+49", "+52", "+54", "+55", "+56", "+58", "+60", "+61", "+64", "+65", "+66", "+81", "+82", "+86", "+90", "+91", "+351", "+352", "+353", "+354", "+356", "+357", "+358", "+370", "+371", "+372", "+377", "+386", "+420", "+421", "+506", "+593", "+598", "+852", "+886", "+972" };

  public static String a()
  {
    String str1 = "";
    String str2 = "";
    String str3 = "";
    String str4 = "";
    String str5 = "";
    String str6 = "";
    String str7 = "";
    String str8 = "";
    String str9 = "";
    Object localObject1 = "";
    String str10 = "";
    try
    {
      str1 = c.c(com.paypal.android.MEP.e.a().f());
      TelephonyManager localTelephonyManager = (TelephonyManager)com.paypal.android.MEP.e.a().e().getSystemService("phone");
      int i = localTelephonyManager.getPhoneType();
      str9 = "MEID";
      str10 = "AndroidCDMA";
      if (i == 1)
      {
        str9 = "IMEI";
        str10 = "AndroidGSM";
      }
      String str23 = localTelephonyManager.getDeviceId();
      str8 = "Phone";
      if (str23 == null)
      {
        str23 = ((WifiManager)com.paypal.android.MEP.e.a().e().getSystemService("wifi")).getConnectionInfo().getMacAddress();
        str9 = "MAC";
        str10 = "AndroidGSM";
        str8 = "Tablet";
      }
      str3 = c.c(str23);
      str5 = c.c(Build.DEVICE);
      str4 = c.c(Build.MODEL);
      str6 = "Android";
      str7 = c.c(Build.VERSION.SDK);
      str2 = c.c(com.paypal.android.MEP.e.y());
      String str24 = com.paypal.android.MEP.e.a().e().getPackageName();
      str13 = str24;
    }
    catch (Exception localException2)
    {
      try
      {
        Context localContext = com.paypal.android.MEP.e.a().e();
        PackageManager localPackageManager = localContext.getPackageManager();
        str25 = localPackageManager.getPackageInfo(localContext.getPackageName(), 0).applicationInfo.loadLabel(localPackageManager).toString();
        if (str25 != null)
        {
          int j = str25.length();
          if (j > 0)
            if (str25 == null)
              str25 = str13;
        }
      }
      catch (Exception localException2)
      {
        while (true)
        {
          String str13;
          try
          {
            if (str3.equals("000000000000000"))
            {
              str26 = "true";
              Object localObject4 = str25;
              String str15 = str9;
              String str16 = str8;
              String str17 = str7;
              String str18 = str6;
              String str19 = str5;
              String str20 = str4;
              String str21 = str3;
              String str22 = str26;
              str11 = str10;
              Object localObject3 = str13;
              StringBuilder localStringBuilder = new StringBuilder();
              localStringBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append("<soap:Envelope ").append("xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" ").append("xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" ").append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ").append("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" ").append("xmlns:GMAdapter=\"http://svcs.paypal.com/mobile/adapter/types/pt\" ").append("xmlns:tns1=\"http://svcs.paypal.com/types/common\" ").append("xmlns:jaxb=\"http://java.sun.com/xml/ns/jaxb\" ").append("xmlns:annox=\"http://annox.dev.java.net\" ").append("xmlns:ov=\"http://annox.dev.java.net/net.sf.oval.constraint\" ").append("xsl:version=\"1.0\">").append("<soap:Body>").append("<DeviceInterrogationRequest>");
              a(localStringBuilder, "version", "2.0");
              a(localStringBuilder, "paypalAppId", str1);
              a(localStringBuilder, "mplVersion", str2);
              a(localStringBuilder, "deviceReferenceToken", d("DeviceReferenceToken"));
              localStringBuilder.append("<deviceDetails>").append("<deviceId>");
              a(localStringBuilder, "deviceIdType", str15);
              a(localStringBuilder, "deviceIdentifier", str21);
              localStringBuilder.append("</deviceId>");
              a(localStringBuilder, "deviceName", str19);
              a(localStringBuilder, "deviceModel", str20);
              a(localStringBuilder, "systemName", str18);
              a(localStringBuilder, "systemVersion", str17);
              a(localStringBuilder, "deviceCategory", str16);
              a(localStringBuilder, "deviceSimulator", str22);
              localStringBuilder.append("</deviceDetails>");
              localStringBuilder.append("<embeddingApplicationDetails>");
              a(localStringBuilder, "deviceAppId", str13);
              a(localStringBuilder, "deviceAppName", (String)localObject3);
              a(localStringBuilder, "deviceAppDisplayName", (String)localObject4);
              a(localStringBuilder, "clientPlatform", str11);
              a(localStringBuilder, "deviceAppVersion", str2);
              localStringBuilder.append("</embeddingApplicationDetails>");
              localStringBuilder.append("<securityDetails>");
              a(localStringBuilder, "applicationNonce", d());
              a(localStringBuilder, "deviceNonce", c());
              localStringBuilder.append("</securityDetails>");
              localStringBuilder.append("</DeviceInterrogationRequest>");
              localStringBuilder.append("</soap:Body>");
              localStringBuilder.append("</soap:Envelope>");
              return localStringBuilder.toString();
              localException1 = localException1;
              str11 = str10;
              str12 = "";
              str13 = "";
              localObject2 = localException1;
              ((Exception)localObject2).printStackTrace();
              String str14 = str12;
              localObject3 = localObject1;
              str15 = str9;
              str16 = str8;
              str17 = str7;
              str18 = str6;
              str19 = str5;
              str20 = str4;
              str21 = str3;
              str22 = "false";
              localObject4 = str14;
              continue;
              localException2 = localException2;
              localObject2 = localException2;
              localObject1 = str13;
              str11 = str10;
              str12 = str13;
              continue;
            }
          }
          catch (Exception localException3)
          {
            Object localObject2 = localException3;
            String str11 = str10;
            String str12 = str25;
            localObject1 = str13;
            continue;
            String str26 = "false";
            continue;
          }
          String str25 = str13;
        }
      }
    }
  }

  public static String a(Hashtable paramHashtable)
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n").append("<soapenv:Body id=\"_0\">\n").append("<ns2:ExecutePaymentRequest xmlns:ns2=\"http://svcs.paypal.com/types/ap\">\n");
    a(localStringBuilder, "payKey", c.c((String)paramHashtable.get("PayKey")));
    localStringBuilder.append("<requestEnvelope>\n");
    a(localStringBuilder, "errorLanguage", PayPalActivity.b.h());
    localStringBuilder.append("</requestEnvelope>\n");
    b(localStringBuilder, "actionType", (String)paramHashtable.get("ActionType"));
    b(localStringBuilder, "fundingPlanId", (String)paramHashtable.get("FundingPlanId"));
    localStringBuilder.append("</ns2:ExecutePaymentRequest>").append("</soapenv:Body>\n").append("</soapenv:Envelope>");
    return localStringBuilder.toString();
  }

  public static String a(Hashtable paramHashtable, String paramString)
  {
    String str = (String)paramHashtable.get("NewPhone");
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"").append(" xmlns:pt=\"http://svcs.paypal.com/mobile/adapter/types/pt\">").append("<soapenv:Header/>").append("<soapenv:Body>").append("<pt:DeviceCreatePinRequest>");
    a(localStringBuilder, "sessionToken", c.n());
    a(localStringBuilder, "version", "1.0");
    localStringBuilder.append("<phone>");
    a(localStringBuilder, "countryCode", c.f(str));
    a(localStringBuilder, "phoneNumber", c.e(str));
    localStringBuilder.append("</phone>");
    a(localStringBuilder, "pin", paramString);
    localStringBuilder.append("<securityDetails>");
    a(localStringBuilder, "applicationNonce", d());
    a(localStringBuilder, "deviceNonce", c());
    localStringBuilder.append("</securityDetails>");
    localStringBuilder.append("</pt:DeviceCreatePinRequest>").append("</soapenv:Body>").append("</soapenv:Envelope>");
    return localStringBuilder.toString();
  }

  public static String a(NodeList paramNodeList)
  {
    String str = "";
    for (int i = 0; i < paramNodeList.getLength(); i++)
      str = str + paramNodeList.item(i).getNodeValue();
    return str;
  }

  protected static StringBuilder a(StringBuilder paramStringBuilder, String paramString1, String paramString2)
  {
    paramStringBuilder.append("<").append(paramString1).append(">").append(paramString2).append("</").append(paramString1).append(">");
    return paramStringBuilder;
  }

  protected static StringBuilder a(StringBuilder paramStringBuilder, String paramString, boolean paramBoolean)
  {
    StringBuilder localStringBuilder = paramStringBuilder.append("<").append(paramString).append(">");
    if (paramBoolean);
    for (String str = "true"; ; str = "false")
    {
      localStringBuilder.append(str).append("</").append(paramString).append(">");
      return paramStringBuilder;
    }
  }

  private static void a(String paramString1, String paramString2)
  {
    try
    {
      FileOutputStream localFileOutputStream = com.paypal.android.MEP.e.a().e().openFileOutput(paramString1, 2);
      localFileOutputStream.write(paramString2.getBytes());
      localFileOutputStream.flush();
      localFileOutputStream.close();
      return;
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      localFileNotFoundException.printStackTrace();
      return;
    }
    catch (IOException localIOException)
    {
    }
  }

  private static void a(Hashtable paramHashtable, Node paramNode, String paramString)
  {
    String str = paramNode.getChildNodes().item(0).getNodeValue();
    paramHashtable.put(paramString, str);
    a("DeviceReferenceToken", str);
  }

  public static void a(Document paramDocument)
  {
    NodeList localNodeList = paramDocument.getElementsByTagName("securityDetails");
    if (localNodeList.getLength() != 1)
      throw new h("Not exactly one securityDetails tag");
    a(localNodeList.item(0));
  }

  private static void a(Node paramNode)
  {
    NodeList localNodeList = paramNode.getChildNodes();
    for (int i = 0; i < localNodeList.getLength(); i++)
    {
      Node localNode = localNodeList.item(i);
      String str1 = localNode.getNodeName();
      if (localNode.getChildNodes().getLength() > 0)
      {
        String str2 = localNode.getChildNodes().item(0).getNodeValue();
        if (str1.compareTo("applicationNonce") == 0)
          a("AppNonce", str2);
        if (str1.compareTo("deviceNonce") == 0)
          a("DeviceNonce", str2);
      }
    }
  }

  public static boolean a(String paramString, Hashtable paramHashtable)
  {
    try
    {
      Document localDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(paramString.getBytes("UTF-8")));
      NodeList localNodeList1 = localDocument.getElementsByTagName("responseEnvelope");
      if (localNodeList1.getLength() == 0)
        return false;
      Element localElement = (Element)localNodeList1.item(0);
      NodeList localNodeList2 = localElement.getElementsByTagName("timestamp");
      if (localNodeList2.getLength() == 0)
        return false;
      paramHashtable.put("TimeStamp", a(((Element)localNodeList2.item(0)).getChildNodes()));
      NodeList localNodeList3 = localElement.getElementsByTagName("ack");
      if (localNodeList3.getLength() == 0)
        return false;
      paramHashtable.put("Ack", a(((Element)localNodeList3.item(0)).getChildNodes()));
      NodeList localNodeList4 = localElement.getElementsByTagName("correlationId");
      if (localNodeList4.getLength() == 0)
        return false;
      paramHashtable.put("CorrelationId", a(((Element)localNodeList4.item(0)).getChildNodes()));
      NodeList localNodeList5 = localElement.getElementsByTagName("build");
      if (localNodeList5.getLength() == 0)
        return false;
      paramHashtable.put("Build", a(((Element)localNodeList5.item(0)).getChildNodes()));
      NodeList localNodeList6 = localDocument.getElementsByTagName("payKey");
      if (localNodeList6.getLength() == 0)
        return false;
      paramHashtable.put("PayKey", a(((Element)localNodeList6.item(0)).getChildNodes()));
      NodeList localNodeList7 = localDocument.getElementsByTagName("paymentExecStatus");
      if (localNodeList7.getLength() == 0)
        return false;
      paramHashtable.put("PaymentExecStatus", a(((Element)localNodeList7.item(0)).getChildNodes()));
      NodeList localNodeList8 = localDocument.getElementsByTagName("defaultFundingPlan");
      if (localNodeList8.getLength() != 0)
        paramHashtable.put("DefaultFundingPlan", com.paypal.android.a.a.c.a((Element)localNodeList8.item(0)));
      NodeList localNodeList9 = localDocument.getElementsByTagName("payErrorList");
      if (localNodeList9.getLength() > 0)
      {
        int i = ((Element)localNodeList9.item(0)).getElementsByTagName("payError").getLength();
        if (i == 0)
          return false;
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      return false;
    }
    return true;
  }

  public static boolean a(Document paramDocument, Hashtable paramHashtable)
  {
    boolean bool1 = true;
    com.paypal.android.MEP.e locale = com.paypal.android.MEP.e.a();
    int i;
    int j;
    label51: Node localNode1;
    String str1;
    try
    {
      NodeList localNodeList1 = paramDocument.getElementsByTagName("ns2:DeviceInterrogationResponse");
      i = 0;
      if (i < localNodeList1.getLength())
      {
        NodeList localNodeList2 = localNodeList1.item(i).getChildNodes();
        j = 0;
        if (j >= localNodeList2.getLength())
          break label573;
        localNode1 = localNodeList2.item(j);
        str1 = localNode1.getNodeName();
        if (str1.equals("payButtonEnable"))
          paramHashtable.put(str1, localNode1.getChildNodes().item(0).getNodeValue());
        else if (str1.equals("deviceReferenceToken"))
          a(paramHashtable, localNode1, str1);
      }
    }
    catch (Exception localException)
    {
      com.paypal.android.MEP.e.b("XMLBuilder", "parseAuthenticationRequest caught exception " + localException.getMessage());
      bool1 = false;
    }
    return bool1;
    int k;
    label204: String str2;
    String str3;
    boolean bool3;
    if (str1.equals("deviceAuthDetails"))
    {
      NodeList localNodeList3 = localNode1.getChildNodes();
      k = 0;
      if (k >= localNodeList3.getLength())
        break label579;
      Node localNode2 = localNodeList3.item(k);
      str2 = localNode2.getNodeName();
      if (localNode2.getChildNodes().getLength() <= 0)
        break label585;
      str3 = localNode2.getChildNodes().item(0).getNodeValue();
      if (str3 == null)
        str3 = "";
      if (str2.equals("userName"))
      {
        locale.d(str3);
        break label585;
      }
      if (str2.equals("email"))
      {
        locale.e(str3);
        break label585;
      }
      if (str2.equals("phone"))
      {
        NodeList localNodeList4 = localNode2.getChildNodes();
        if (localNodeList4.getLength() != 2)
          break label591;
        bool3 = bool1;
        label353: Assert.assertTrue("Bad XML, <phone> doesn't have 2 children", bool3);
        String str4 = "";
        NodeList localNodeList5 = localNodeList4.item(0).getChildNodes();
        if (localNodeList5.getLength() > 0)
          str4 = localNodeList5.item(0).getNodeValue();
        locale.g(str4);
        String str5 = "";
        NodeList localNodeList6 = localNodeList4.item(1).getChildNodes();
        if (localNodeList6.getLength() > 0)
          str5 = localNodeList6.item(0).getNodeValue();
        locale.f("+" + c.m() + str5);
        break label585;
      }
      if (str2.equals("authMethod"))
      {
        int m = Integer.parseInt(str3);
        locale.a(m);
        if (m != 2)
          break label597;
      }
    }
    label573: label579: label585: label591: label597: for (boolean bool2 = bool1; ; bool2 = false)
    {
      locale.b(bool2);
      break label585;
      if (str2.equals("authSetting"))
      {
        locale.b(Integer.parseInt(str3));
        break label585;
        if (str1.equals("securityDetails"))
        {
          a(localNode1);
          break label579;
          i++;
          break;
        }
        j++;
        break label51;
      }
      k++;
      break label204;
      bool3 = false;
      break label353;
    }
  }

  public static String[] a(String paramString)
  {
    Vector localVector = new Vector();
    while (true)
    {
      try
      {
        NodeList localNodeList = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(paramString.getBytes("UTF-8"))).getElementsByTagName("parameter");
        int j;
        String[] arrayOfString;
        int i;
        if (localNodeList != null)
        {
          if (localNodeList.getLength() != 0)
            break label155;
          break label153;
          if (j < localNodeList.getLength())
          {
            localVector.add(localNodeList.item(j).getChildNodes().item(0).getNodeValue());
            j++;
            continue;
          }
        }
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        arrayOfString = new String[localVector.size()];
        i = 0;
        if (i < localVector.size())
        {
          arrayOfString[i] = ((String)localVector.get(i));
          i++;
          continue;
        }
        return arrayOfString;
      }
      label153: return null;
      label155: j = 0;
    }
  }

  public static String b()
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"").append(" xmlns:pt=\"http://svcs.paypal.com/mobile/adapter/types/pt\">").append("<soapenv:Header/>").append("<soapenv:Body>").append("<pt:RemoveDeviceAuthorizationRequest>");
    a(localStringBuilder, "deviceReferenceToken", d("DeviceReferenceToken"));
    localStringBuilder.append("<securityDetails>");
    a(localStringBuilder, "applicationNonce", d());
    a(localStringBuilder, "deviceNonce", c());
    localStringBuilder.append("</securityDetails>").append("</pt:RemoveDeviceAuthorizationRequest>").append("</soapenv:Body>").append("</soapenv:Envelope>");
    return localStringBuilder.toString();
  }

  public static String b(String paramString)
  {
    try
    {
      NodeList localNodeList = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(paramString.getBytes("UTF-8"))).getElementsByTagName("TransactionID");
      if (localNodeList != null)
      {
        if (localNodeList.getLength() == 0)
          return null;
        String str = localNodeList.item(0).getChildNodes().item(0).getNodeValue();
        return str;
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return null;
  }

  public static String b(Hashtable paramHashtable)
  {
    String str1 = PayPalActivity.b.h();
    com.paypal.android.a.a.e locale = (com.paypal.android.a.a.e)paramHashtable.get("ClientDetails");
    String str2 = (String)paramHashtable.get("CurrencyCode");
    String str3 = (String)paramHashtable.get("DateOfMonth");
    String str4 = (String)paramHashtable.get("DayOfWeek");
    String str5 = (String)paramHashtable.get("EndingDate");
    String str6 = c.c((String)paramHashtable.get("IpnNotificationUrl"));
    String str7 = (String)paramHashtable.get("MaxAmountPerPayment");
    String str8 = (String)paramHashtable.get("MaxNumberOfPayments");
    String str9 = (String)paramHashtable.get("MaxNumberOfPaymentsPerPeriod");
    String str10 = (String)paramHashtable.get("MaxTotalAmountOfAllPayments");
    String str11 = c.c((String)paramHashtable.get("Memo"));
    String str12 = (String)paramHashtable.get("PaymentPeriod");
    String str13 = (String)paramHashtable.get("PinType");
    String str14 = c.c((String)paramHashtable.get("SenderEmail"));
    String str15 = (String)paramHashtable.get("StartingDate");
    String str16 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n<soapenv:Body id=\"_0\">\n<ns2:PreapprovalRequest xmlns:ns2=\"http://svcs.paypal.com/types/ap\">\n<requestEnvelope>\n<errorLanguage>" + str1 + "</errorLanguage>\n" + "</requestEnvelope>\n" + "<cancelUrl>" + "https://www.paypal.com" + "</cancelUrl>\n" + "<currencyCode>" + str2 + "</currencyCode>\n" + "<endingDate>" + str5 + "</endingDate>\n" + "<maxTotalAmountOfAllPayments>" + str10 + "</maxTotalAmountOfAllPayments>\n" + "<returnUrl>" + "https://www.paypal.com" + "</returnUrl>\n" + "<startingDate>" + str15 + "</startingDate>\n";
    if ((locale == null) || ((str3 != null) && (str3.length() > 0)));
    for (String str17 = str16 + "<dateOfMonth>" + str3 + "</dateOfMonth>\n"; ; str17 = str16)
    {
      if ((str4 != null) && (str4.length() > 0))
        str17 = str17 + "<dayOfWeek>" + str4 + "</dayOfWeek>\n";
      if ((str6 != null) && (str6.length() > 0))
        str17 = str17 + "<ipnNotificationUrl>" + c.c(str6) + "</ipnNotificationUrl>\n";
      if ((str7 != null) && (str7.length() > 0))
        str17 = str17 + "<maxAmountPerPayment>" + str7 + "</maxAmountPerPayment>\n";
      if ((str8 != null) && (str8.length() > 0))
        str17 = str17 + "<maxNumberOfPayments>" + str8 + "</maxNumberOfPayments>\n";
      if ((str9 != null) && (str9.length() > 0))
        str17 = str17 + "<maxNumberOfPaymentsPerPeriod>" + str9 + "</maxNumberOfPaymentsPerPeriod>\n";
      if ((str11 != null) && (str11.length() > 0))
        str17 = str17 + "<memo>" + c.c(str11) + "</memo>\n";
      if ((str12 != null) && (str12.length() > 0))
        str17 = str17 + "<paymentPeriod>" + str12 + "</paymentPeriod>\n";
      if ((str13 != null) && (str13.length() > 0))
        str17 = str17 + "<pinType>" + str13 + "</pinType>\n";
      if ((str14 != null) && (str14.length() > 0))
        str17 = str17 + "<senderEmail>" + c.c(str14) + "</senderEmail>\n";
      return str17 + "</ns2:PreapprovalRequest></soapenv:Body>\n</soapenv:Envelope>";
    }
  }

  private static void b(StringBuilder paramStringBuilder, String paramString1, String paramString2)
  {
    if (paramString2 != null)
      a(paramStringBuilder, paramString1, paramString2);
  }

  public static boolean b(String paramString, Hashtable paramHashtable)
  {
    try
    {
      Document localDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(paramString.getBytes("UTF-8")));
      NodeList localNodeList1 = localDocument.getElementsByTagName("responseEnvelope");
      if (localNodeList1.getLength() == 0)
        return false;
      Element localElement = (Element)localNodeList1.item(0);
      NodeList localNodeList2 = localElement.getElementsByTagName("timestamp");
      if (localNodeList2.getLength() == 0)
        return false;
      paramHashtable.put("TimeStamp", a(((Element)localNodeList2.item(0)).getChildNodes()));
      NodeList localNodeList3 = localElement.getElementsByTagName("ack");
      if (localNodeList3.getLength() == 0)
        return false;
      paramHashtable.put("Ack", a(((Element)localNodeList3.item(0)).getChildNodes()));
      NodeList localNodeList4 = localElement.getElementsByTagName("correlationId");
      if (localNodeList4.getLength() == 0)
        return false;
      paramHashtable.put("CorrelationId", a(((Element)localNodeList4.item(0)).getChildNodes()));
      NodeList localNodeList5 = localElement.getElementsByTagName("build");
      if (localNodeList5.getLength() == 0)
        return false;
      paramHashtable.put("Build", a(((Element)localNodeList5.item(0)).getChildNodes()));
      NodeList localNodeList6 = localDocument.getElementsByTagName("preapprovalKey");
      if (localNodeList6.getLength() == 0)
        return false;
      paramHashtable.put("PreapprovalKey", a(((Element)localNodeList6.item(0)).getChildNodes()));
      return true;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return false;
  }

  public static boolean b(Document paramDocument)
  {
    NodeList localNodeList = paramDocument.getElementsByTagName("securityDetails");
    if (localNodeList.getLength() != 1)
      throw new h("");
    a(localNodeList.item(0));
    return true;
  }

  public static int c(Document paramDocument)
  {
    try
    {
      NodeList localNodeList = paramDocument.getElementsByTagName("ErrorCode");
      if ((localNodeList == null) || (localNodeList.getLength() == 0))
      {
        localNodeList = paramDocument.getElementsByTagName("errorId");
        if ((localNodeList == null) || (localNodeList.getLength() == 0));
      }
      else
      {
        int i = Integer.parseInt(localNodeList.item(0).getChildNodes().item(0).getNodeValue());
        return i;
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
      return 10004;
    }
    return 200;
  }

  private static String c()
  {
    String str = d("DeviceNonce");
    if (str.length() > 0)
      return str;
    return "None";
  }

  public static String c(String paramString)
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append("<soap:Envelope ").append("xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" ").append("xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" ").append("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ").append("xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" ").append("xmlns:GMAdapter=\"http://svcs.paypal.com/mobile/adapter/types/pt\" ").append("xmlns:tns1=\"http://svcs.paypal.com/types/common\" ").append("xmlns:jaxb=\"http://java.sun.com/xml/ns/jaxb\" ").append("xmlns:annox=\"http://annox.dev.java.net\" ").append("xmlns:ov=\"http://annox.dev.java.net/net.sf.oval.constraint\" ").append("xsl:version=\"1.0\">").append("<soap:Body>").append("<GMAdapter:DeviceAuthenticationRequest>");
    a(localStringBuilder, "version", "1.0");
    a(localStringBuilder, "paypalAppId", c.c(com.paypal.android.MEP.e.a().f()));
    a(localStringBuilder, "mplVersion", com.paypal.android.MEP.e.y());
    if (paramString.length() > 0)
      localStringBuilder.append(paramString);
    a(localStringBuilder, "deviceReferenceToken", d("DeviceReferenceToken"));
    localStringBuilder.append("<securityDetails>");
    a(localStringBuilder, "applicationNonce", d());
    a(localStringBuilder, "deviceNonce", c());
    localStringBuilder.append("</securityDetails>");
    localStringBuilder.append("</GMAdapter:DeviceAuthenticationRequest>");
    localStringBuilder.append("</soap:Body>");
    localStringBuilder.append("</soap:Envelope>");
    return localStringBuilder.toString();
  }

  public static String c(Hashtable paramHashtable)
  {
    String str1 = PayPalActivity.b.h();
    String str2 = c.c((String)paramHashtable.get("PreapprovalKey"));
    String str3 = (String)paramHashtable.get("Pin");
    String str4 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n<soapenv:Body id=\"_0\">\n<ns2:ConfirmPreapprovalRequest xmlns:ns2=\"http://svcs.paypal.com/types/ap\">\n<requestEnvelope>\n<errorLanguage>" + str1 + "</errorLanguage>\n" + "</requestEnvelope>\n" + "<preapprovalKey>" + str2 + "</preapprovalKey>\n";
    if (str3 != null);
    for (String str5 = str4 + "<pin>" + str3 + "</pin>\n"; ; str5 = str4)
      return str5 + "</ns2:ConfirmPreapprovalRequest></soapenv:Body>\n</soapenv:Envelope>";
  }

  public static boolean c(String paramString, Hashtable paramHashtable)
  {
    try
    {
      Document localDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(paramString.getBytes("UTF-8")));
      com.paypal.android.MEP.e locale = com.paypal.android.MEP.e.a();
      l locall = locale.d();
      NodeList localNodeList1 = localDocument.getElementsByTagName("responseEnvelope");
      if (localNodeList1.getLength() == 0)
        return false;
      Element localElement = (Element)localNodeList1.item(0);
      NodeList localNodeList2 = localElement.getElementsByTagName("timestamp");
      if (localNodeList2.getLength() == 0)
        return false;
      paramHashtable.put("TimeStamp", a(((Element)localNodeList2.item(0)).getChildNodes()));
      NodeList localNodeList3 = localElement.getElementsByTagName("ack");
      if (localNodeList3.getLength() == 0)
        return false;
      paramHashtable.put("Ack", a(((Element)localNodeList3.item(0)).getChildNodes()));
      NodeList localNodeList4 = localElement.getElementsByTagName("correlationId");
      if (localNodeList4.getLength() == 0)
        return false;
      paramHashtable.put("CorrelationId", a(((Element)localNodeList4.item(0)).getChildNodes()));
      NodeList localNodeList5 = localElement.getElementsByTagName("build");
      if (localNodeList5.getLength() == 0)
        return false;
      paramHashtable.put("Build", a(((Element)localNodeList5.item(0)).getChildNodes()));
      NodeList localNodeList6 = localDocument.getElementsByTagName("approved");
      if (localNodeList6.getLength() == 0)
        return false;
      String str1 = a(((Element)localNodeList6.item(0)).getChildNodes());
      locall.a(str1.equals("true"));
      paramHashtable.put("Approved", str1);
      NodeList localNodeList7 = localDocument.getElementsByTagName("cancelUrl");
      if (localNodeList7.getLength() == 0)
        return false;
      String str2 = a(((Element)localNodeList7.item(0)).getChildNodes());
      locale.b(str2);
      paramHashtable.put("CancelUrl", str2);
      NodeList localNodeList8 = localDocument.getElementsByTagName("currencyCode");
      if (localNodeList8.getLength() == 0)
        return false;
      String str3 = a(((Element)localNodeList8.item(0)).getChildNodes());
      locall.a(str3);
      paramHashtable.put("CurrencyCode", str3);
      NodeList localNodeList9 = localDocument.getElementsByTagName("dateOfMonth");
      if (localNodeList9.getLength() > 0)
      {
        String str16 = a(((Element)localNodeList9.item(0)).getChildNodes());
        locall.d(Integer.parseInt(str16));
        paramHashtable.put("DateOfMonth", str16);
      }
      NodeList localNodeList10 = localDocument.getElementsByTagName("dayOfWeek");
      if (localNodeList10.getLength() > 0)
      {
        String str15 = a(((Element)localNodeList10.item(0)).getChildNodes());
        locall.c(locall.g(str15));
        paramHashtable.put("DayOfWeek", str15);
      }
      NodeList localNodeList11 = localDocument.getElementsByTagName("endingDate");
      if (localNodeList11.getLength() > 0)
      {
        String str14 = a(((Element)localNodeList11.item(0)).getChildNodes());
        locall.c(str14);
        paramHashtable.put("EndingDate", str14);
      }
      NodeList localNodeList12 = localDocument.getElementsByTagName("ipnNotificationUrl");
      if (localNodeList12.getLength() > 0)
      {
        String str13 = a(((Element)localNodeList12.item(0)).getChildNodes());
        locall.d(str13);
        paramHashtable.put("IpnNotificationUrl", str13);
      }
      NodeList localNodeList13 = localDocument.getElementsByTagName("maxAmountPerPayment");
      if (localNodeList13.getLength() > 0)
      {
        String str12 = a(((Element)localNodeList13.item(0)).getChildNodes());
        locall.a(new BigDecimal(str12));
        paramHashtable.put("MaxAmountPerPayment", str12);
      }
      NodeList localNodeList14 = localDocument.getElementsByTagName("maxNumberOfPayments");
      if (localNodeList14.getLength() > 0)
      {
        String str11 = a(((Element)localNodeList14.item(0)).getChildNodes());
        locall.a(Integer.parseInt(str11));
        paramHashtable.put("MaxNumberOfPayments", str11);
      }
      NodeList localNodeList15 = localDocument.getElementsByTagName("maxNumberOfPaymentsPerPeriod");
      if (localNodeList15.getLength() > 0)
      {
        String str10 = a(((Element)localNodeList15.item(0)).getChildNodes());
        locall.e(Integer.parseInt(str10));
        paramHashtable.put("MaxNumberOfPaymentsPerPeriod", str10);
      }
      NodeList localNodeList16 = localDocument.getElementsByTagName("maxTotalAmountOfAllPayments");
      if (localNodeList16.getLength() == 0)
        return false;
      String str4 = a(((Element)localNodeList16.item(0)).getChildNodes());
      locall.b(new BigDecimal(str4));
      paramHashtable.put("MaxTotalAmountOfAllPayments", str4);
      NodeList localNodeList17 = localDocument.getElementsByTagName("memo");
      if (localNodeList17.getLength() > 0)
      {
        String str9 = a(((Element)localNodeList17.item(0)).getChildNodes());
        locall.e(str9);
        paramHashtable.put("Memo", str9);
      }
      NodeList localNodeList18 = localDocument.getElementsByTagName("paymentPeriod");
      if (localNodeList18.getLength() > 0)
      {
        String str8 = a(((Element)localNodeList18.item(0)).getChildNodes());
        locall.b(locall.f(str8));
        paramHashtable.put("PaymentPeriod", str8);
      }
      NodeList localNodeList19 = localDocument.getElementsByTagName("pinType");
      if (localNodeList19.getLength() > 0)
      {
        String str7 = a(((Element)localNodeList19.item(0)).getChildNodes());
        locall.b(str7.equals("REQUIRED"));
        paramHashtable.put("PinType", str7);
      }
      NodeList localNodeList20 = localDocument.getElementsByTagName("returnUrl");
      if (localNodeList20.getLength() == 0)
        return false;
      String str5 = a(((Element)localNodeList20.item(0)).getChildNodes());
      locale.c(str5);
      paramHashtable.put("ReturnUrl", str5);
      NodeList localNodeList21 = localDocument.getElementsByTagName("senderEmail");
      if (localNodeList21.getLength() > 0)
        paramHashtable.put("SenderEmail", a(((Element)localNodeList21.item(0)).getChildNodes()));
      NodeList localNodeList22 = localDocument.getElementsByTagName("startingDate");
      if (localNodeList22.getLength() == 0)
        return false;
      String str6 = a(((Element)localNodeList22.item(0)).getChildNodes());
      locall.b(str6);
      paramHashtable.put("StartingDate", str6);
      paramHashtable.put("PreapprovalDetails", locall);
      return true;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return false;
  }

  private static String d()
  {
    String str = d("AppNonce");
    if (str.length() > 0)
      return str;
    return "None";
  }

  private static String d(String paramString)
  {
    try
    {
      FileInputStream localFileInputStream = com.paypal.android.MEP.e.a().e().openFileInput(paramString);
      byte[] arrayOfByte = new byte[localFileInputStream.available()];
      localFileInputStream.read(arrayOfByte);
      localFileInputStream.close();
      str = new String(arrayOfByte);
      if (str == null)
        str = "";
      return str;
    }
    catch (Exception localException)
    {
      while (true)
        String str = null;
    }
  }

  public static String d(Hashtable paramHashtable)
  {
    String str1 = PayPalActivity.b.h();
    String str2 = c.c((String)paramHashtable.get("PreapprovalKey"));
    String str3 = c.c((String)paramHashtable.get("GetBillingAddress"));
    String str4 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n<soapenv:Body id=\"_0\">\n<ns2:PreapprovalDetailsRequest xmlns:ns2=\"http://svcs.paypal.com/types/ap\">\n<requestEnvelope>\n<errorLanguage>" + str1 + "</errorLanguage>\n" + "</requestEnvelope>\n" + "<preapprovalKey>" + str2 + "</preapprovalKey>\n";
    if (str3 != null)
      str4 = str4 + "<getBillingAddress>" + str3 + "</getBillingAddress>\n";
    return str4 + "</ns2:PreapprovalDetailsRequest></soapenv:Body>\n</soapenv:Envelope>";
  }

  public static boolean d(String paramString, Hashtable paramHashtable)
  {
    try
    {
      NodeList localNodeList1 = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(paramString.getBytes("UTF-8"))).getElementsByTagName("responseEnvelope");
      if (localNodeList1.getLength() == 0)
        return false;
      Element localElement = (Element)localNodeList1.item(0);
      NodeList localNodeList2 = localElement.getElementsByTagName("timestamp");
      if (localNodeList2.getLength() == 0)
        return false;
      paramHashtable.put("TimeStamp", a(((Element)localNodeList2.item(0)).getChildNodes()));
      NodeList localNodeList3 = localElement.getElementsByTagName("ack");
      if (localNodeList3.getLength() == 0)
        return false;
      paramHashtable.put("Ack", a(((Element)localNodeList3.item(0)).getChildNodes()));
      NodeList localNodeList4 = localElement.getElementsByTagName("correlationId");
      if (localNodeList4.getLength() == 0)
        return false;
      paramHashtable.put("CorrelationId", a(((Element)localNodeList4.item(0)).getChildNodes()));
      NodeList localNodeList5 = localElement.getElementsByTagName("build");
      if (localNodeList5.getLength() == 0)
        return false;
      paramHashtable.put("Build", a(((Element)localNodeList5.item(0)).getChildNodes()));
      return true;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return false;
  }

  private static String e(String paramString)
  {
    int i = 0;
    boolean bool;
    if (paramString.indexOf("+") == 0)
    {
      bool = true;
      Assert.assertTrue("phone number must have +, country dialing code, phone number", bool);
    }
    while (true)
    {
      if (i >= a.length)
        break label64;
      if (paramString.indexOf(a[i]) >= 0)
      {
        return paramString.replace(a[i], "");
        bool = false;
        break;
      }
      i++;
    }
    label64: throw new p("unusable phone number " + paramString);
  }

  public static String e(Hashtable paramHashtable)
  {
    String str1 = c.c((String)paramHashtable.get("PayKey"));
    String str2 = PayPalActivity.b.h();
    return "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n<soapenv:Body id=\"_0\">\n<ns2:GetFundingPlansRequest xmlns:ns2=\"http://svcs.paypal.com/types/ap\">\n<payKey>" + str1 + "</payKey>\n" + "<requestEnvelope>\n" + "<errorLanguage>" + str2 + "</errorLanguage>\n" + "</requestEnvelope>\n" + "</ns2:GetFundingPlansRequest>" + "</soapenv:Body>\n" + "</soapenv:Envelope>";
  }

  public static boolean e(String paramString, Hashtable paramHashtable)
  {
    try
    {
      Document localDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(paramString.getBytes("UTF-8")));
      NodeList localNodeList1 = localDocument.getElementsByTagName("responseEnvelope");
      if (localNodeList1.getLength() == 0)
        return false;
      Element localElement = (Element)localNodeList1.item(0);
      NodeList localNodeList2 = localElement.getElementsByTagName("timestamp");
      if (localNodeList2.getLength() == 0)
        return false;
      paramHashtable.put("TimeStamp", a(((Element)localNodeList2.item(0)).getChildNodes()));
      NodeList localNodeList3 = localElement.getElementsByTagName("ack");
      if (localNodeList3.getLength() == 0)
        return false;
      paramHashtable.put("Ack", a(((Element)localNodeList3.item(0)).getChildNodes()));
      NodeList localNodeList4 = localElement.getElementsByTagName("correlationId");
      if (localNodeList4.getLength() == 0)
        return false;
      paramHashtable.put("CorrelationId", a(((Element)localNodeList4.item(0)).getChildNodes()));
      NodeList localNodeList5 = localElement.getElementsByTagName("build");
      if (localNodeList5.getLength() == 0)
        return false;
      paramHashtable.put("Build", a(((Element)localNodeList5.item(0)).getChildNodes()));
      Vector localVector = new Vector();
      NodeList localNodeList6 = localDocument.getElementsByTagName("fundingPlan");
      for (int i = 0; i < localNodeList6.getLength(); i++)
        localVector.add(com.paypal.android.a.a.c.a((Element)localNodeList6.item(i)));
      paramHashtable.put("FundingPlans", localVector);
      return true;
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return false;
  }

  private static String f(String paramString)
  {
    int i = 0;
    boolean bool;
    if (paramString.indexOf("+") == 0)
    {
      bool = true;
      Assert.assertTrue("phone number must have +, country dialing code, phone number", bool);
    }
    while (true)
    {
      if (i >= a.length)
        break label62;
      if (paramString.indexOf(a[i]) >= 0)
      {
        return a[i].substring(1);
        bool = false;
        break;
      }
      i++;
    }
    label62: throw new p("unusable phone number " + paramString);
  }

  public static String f(Hashtable paramHashtable)
  {
    String str1 = (String)paramHashtable.get("PaymentCurrencyID");
    String str2 = PayPalActivity.b.h();
    String str3 = (String)paramHashtable.get("TrackingId");
    String str4 = (String)paramHashtable.get("ReverseAllParallelPaymentsOnError");
    if (str4 == null);
    for (String str5 = "true"; ; str5 = str4)
    {
      String str6 = (String)paramHashtable.get("Pin");
      String str7 = c.c((String)paramHashtable.get("IpnNotificationUrl"));
      String str8 = (String)paramHashtable.get("FeesPayer");
      String str9 = (String)paramHashtable.get("FundingType");
      String str10 = c.c((String)paramHashtable.get("Memo"));
      com.paypal.android.a.a.e locale = (com.paypal.android.a.a.e)paramHashtable.get("ClientDetails");
      ArrayList localArrayList = (ArrayList)paramHashtable.get("Receivers");
      if (localArrayList == null)
        return null;
      String str11 = (String)paramHashtable.get("ActionType");
      String str12 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Body>\n<ns2:Pay xmlns:ns2=\"http://svcs.paypal.com/services\">\n<requestEnvelope>\n<errorLanguage>" + str2 + "</errorLanguage>\n" + "</requestEnvelope>\n" + "<sender>\n" + "<useCredentials>true</useCredentials>\n" + "</sender>\n" + "<actionType>" + str11 + "</actionType>\n" + "<cancelUrl>" + "https://www.paypal.com" + "</cancelUrl>\n" + "<returnUrl>" + "https://www.paypal.com" + "</returnUrl>\n" + "<currencyCode>" + str1 + "</currencyCode>\n" + "<receiverList>\n";
      int i = 0;
      BigDecimal localBigDecimal1;
      BigDecimal localBigDecimal3;
      BigDecimal localBigDecimal4;
      if (i < localArrayList.size())
      {
        localBigDecimal1 = ((m)localArrayList.get(i)).b();
        if (((m)localArrayList.get(i)).c() == null)
          break label1446;
        localBigDecimal3 = ((m)localArrayList.get(i)).c().b();
        localBigDecimal4 = ((m)localArrayList.get(i)).c().a();
        if (localBigDecimal3 == null)
          break label1460;
      }
      label912: label1446: label1460: for (BigDecimal localBigDecimal5 = localBigDecimal1.add(localBigDecimal3); ; localBigDecimal5 = localBigDecimal1)
      {
        BigDecimal localBigDecimal2;
        if (localBigDecimal4 != null)
          localBigDecimal2 = localBigDecimal5.add(localBigDecimal4);
        while (true)
        {
          localBigDecimal2.setScale(2, 4);
          localBigDecimal1.setScale(2, 4);
          int j = ((m)localArrayList.get(i)).d();
          int k = ((m)localArrayList.get(i)).e();
          boolean bool = ((m)localArrayList.get(i)).i();
          String str15 = str12 + "<receiver>\n";
          String str16 = str15 + "<amount>" + localBigDecimal2.toString() + "</amount>\n";
          String str17 = ((m)localArrayList.get(i)).a();
          if ((str17 != null) && (str17.length() > 0))
          {
            if (((m)localArrayList.get(i)).j());
            String str21;
            for (String str22 = str16 + "<email>" + c.c(str17) + "</email>\n"; ; str22 = str21 + "</phone>\n")
            {
              if (j != 3)
                str22 = str22 + "<paymentType>" + com.paypal.android.MEP.e.c(j) + "</paymentType>\n";
              if (k != 22)
                str22 = str22 + "<paymentSubtype>" + com.paypal.android.MEP.e.d(k) + "</paymentSubtype>\n";
              if (bool)
                str22 = str22 + "<primary>" + bool + "</primary>\n";
              str12 = str22 + "</receiver>\n";
              i++;
              break;
              if (!((m)localArrayList.get(i)).k())
                break label912;
              String str18 = str16 + "<phone>\n";
              String str19 = f(str17);
              if ((str19 == null) || (str19.length() == 0))
                str19 = c.m();
              String str20 = str18 + "<countryCode>" + str19 + "</countryCode>";
              str21 = str20 + "<phoneNumber>" + e(str17) + "</phoneNumber>";
            }
            return null;
          }
          return null;
          String str13 = str12 + "</receiverList>\n";
          if ((str3 != null) && (str3.length() > 0))
            str13 = str13 + "<trackingId>" + c.c(str3) + "</trackingId>\n";
          if ((str5 != null) && (str5.length() > 0))
            str13 = str13 + "<reverseAllParallelPaymentsOnError>" + str5 + "</reverseAllParallelPaymentsOnError>\n";
          if ((str6 != null) && (str6.length() > 0))
            str13 = str13 + "<pin>" + str6 + "</pin>\n";
          if ((str7 != null) && (str7.length() > 0))
            str13 = str13 + "<ipnNotificationUrl>" + c.c(str7) + "</ipnNotificationUrl>\n";
          if ((str8 != null) && (str8.length() > 0))
            str13 = str13 + "<feesPayer>" + str8 + "</feesPayer>\n";
          if ((str9 != null) && (str9.length() > 0))
            str13 = str13 + "<fundingConstraint>\n<allowedFundingType>\n<fundingTypeInfo>\n<fundingType>" + str9 + "</fundingType>\n" + "</fundingTypeInfo>\n" + "</allowedFundingType>\n" + "</fundingConstraint>\n";
          if ((locale == null) || ((str10 != null) && (str10.length() > 0)))
            str13 = str13 + "<memo>" + c.c(str10) + "</memo>\n";
          String str14 = str13 + "</ns2:Pay></soapenv:Body>\n</soapenv:Envelope>";
          try
          {
            str14.getBytes(Charset.forName("UTF-8").name());
            return str14;
          }
          catch (IllegalCharsetNameException localIllegalCharsetNameException)
          {
            com.paypal.android.MEP.e.b("XMLBuilder", "Exception " + localIllegalCharsetNameException.getMessage());
            return str14;
          }
          catch (UnsupportedCharsetException localUnsupportedCharsetException)
          {
            com.paypal.android.MEP.e.b("XMLBuilder", "Exception " + localUnsupportedCharsetException.getMessage());
            return str14;
          }
          catch (UnsupportedEncodingException localUnsupportedEncodingException)
          {
            com.paypal.android.MEP.e.b("XMLBuilder", "Exception " + localUnsupportedEncodingException.getMessage());
            return str14;
          }
          localBigDecimal2 = localBigDecimal1;
          continue;
          localBigDecimal2 = localBigDecimal5;
        }
      }
    }
  }

  public static boolean f(String paramString, Hashtable paramHashtable)
  {
    try
    {
      NodeList localNodeList1 = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(paramString.getBytes("UTF-8"))).getElementsByTagName("MEPRemoveDeviceAuthorizationResponseType");
      for (int i = 0; i < localNodeList1.getLength(); i++)
      {
        NodeList localNodeList2 = localNodeList1.item(i).getChildNodes();
        for (int j = 0; j < localNodeList2.getLength(); j++)
        {
          Node localNode = localNodeList2.item(j);
          String str = localNode.getNodeName();
          if (str.compareTo("DeviceReferenceToken") == 0)
            a(paramHashtable, localNode, str);
        }
      }
      return true;
    }
    catch (Exception localException)
    {
    }
    return false;
  }

  public static String g(Hashtable paramHashtable)
  {
    String str1 = (String)paramHashtable.get("PayKey");
    String str2 = PayPalActivity.b.h();
    b localb = (b)paramHashtable.get("DisplayOptions");
    d locald = (d)paramHashtable.get("InstitutionCustomer");
    String str3 = (String)paramHashtable.get("ShippingAddressId");
    com.paypal.android.a.a.i locali = (com.paypal.android.a.a.i)paramHashtable.get("SenderOptions");
    ArrayList localArrayList = (ArrayList)paramHashtable.get("Receivers");
    String str4 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n<soapenv:Body id=\"_0\">\n<ns2:SetPaymentOptionsRequest xmlns:ns2=\"http://svcs.paypal.com/types/ap\">\n<payKey>" + c.c(str1) + "</payKey>\n" + "<requestEnvelope>\n" + "<errorLanguage>" + str2 + "</errorLanguage>\n" + "</requestEnvelope>\n";
    if ((localb == null) || ((locald == null) || (str3 != null)))
      str4 = str4 + "<shippingAddressId>" + c.c(str3) + "</shippingAddressId>\n";
    if (locali != null)
      str4 = str4 + "<senderOptions>\n<sharePhoneNumber>" + false + "</sharePhoneNumber>\n" + "<shareAddress>" + false + "</shareAddress>\n" + "<requireShippingAddressSelection>" + false + "</requireShippingAddressSelection>\n" + "</senderOptions>\n";
    int i;
    Object localObject;
    m localm;
    String str6;
    String str7;
    if (localArrayList != null)
    {
      i = 0;
      localObject = str4;
      if (i >= localArrayList.size())
        break label1322;
      localm = (m)localArrayList.get(i);
      String str5 = (String)localObject + "<receiverOptions>\n";
      if ((localm.f() != null) && (localm.f().length() > 0))
        str5 = str5 + "<description>" + c.c(localm.f()) + "</description>\n";
      if ((localm.g() != null) && (localm.g().length() > 0))
        str5 = str5 + "<customId>" + c.c(localm.g()) + "</customId>\n";
      if (localm.c() != null)
      {
        String str13 = str5 + "<invoiceData>\n";
        int j = 0;
        String str14 = str13;
        while (j < localm.c().c().size())
        {
          j localj = (j)localm.c().c().get(j);
          String str15 = str14 + "<item>\n";
          if ((localj.a() != null) && (localj.a().length() > 0))
            str15 = str15 + "<name>" + c.c(localj.a()) + "</name>\n";
          if ((localj.b() != null) && (localj.b().length() > 0))
            str15 = str15 + "<identifier>" + c.c(localj.b()) + "</identifier>\n";
          if ((localj.c() != null) && (localj.c().toString().length() > 0))
            str15 = str15 + "<price>" + c.c(localj.c().toString()) + "</price>\n";
          if ((localj.d() != null) && (localj.d().toString().length() > 0))
            str15 = str15 + "<itemPrice>" + c.c(localj.d().toString()) + "</itemPrice>\n";
          if (localj.e() > 0)
            str15 = str15 + "<itemCount>" + c.c(new StringBuilder().append("").append(localj.e()).toString()) + "</itemCount>\n";
          str14 = str15 + "</item>\n";
          j++;
        }
        if ((localm.c().a() != null) && (localm.c().a().compareTo(BigDecimal.ZERO) > 0))
          str14 = str14 + "<totalTax>" + c.c(localm.c().a().toString()) + "</totalTax>\n";
        if ((localm.c().b() != null) && (localm.c().b().compareTo(BigDecimal.ZERO) > 0))
          str14 = str14 + "<totalShipping>" + c.c(localm.c().b().toString()) + "</totalShipping>\n";
        str5 = str14 + "</invoiceData>\n";
      }
      str6 = str5 + "<receiver>\n";
      if (localm.j())
        str7 = str6 + "<email>" + c.c(localm.a()) + "</email>\n";
    }
    while (true)
    {
      String str8 = str7 + "</receiver>\n</receiverOptions>\n";
      i++;
      localObject = str8;
      break;
      if (((m)localArrayList.get(i)).k())
      {
        String str9 = str6 + "<phone>\n";
        String str10 = f(localm.a());
        if ((str10 == null) || (str10.length() == 0))
          str10 = c.m();
        String str11 = str9 + "<countryCode>" + str10 + "</countryCode>";
        String str12 = str11 + "<phoneNumber>" + e(localm.a()) + "</phoneNumber>";
        str7 = str12 + "</phone>\n";
        continue;
        localObject = str4;
        label1322: return (String)localObject + "</ns2:SetPaymentOptionsRequest></soapenv:Body>\n</soapenv:Envelope>";
      }
      else
      {
        str7 = str6;
      }
    }
  }

  public static boolean g(String paramString, Hashtable paramHashtable)
  {
    while (true)
    {
      int i;
      try
      {
        Document localDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(paramString.getBytes("UTF-8")));
        NodeList localNodeList1 = localDocument.getElementsByTagName("responseEnvelope");
        if (localNodeList1.getLength() == 0)
          return false;
        Element localElement = (Element)localNodeList1.item(0);
        NodeList localNodeList2 = localElement.getElementsByTagName("timestamp");
        if (localNodeList2.getLength() == 0)
          return false;
        paramHashtable.put("TimeStamp", a(((Element)localNodeList2.item(0)).getChildNodes()));
        NodeList localNodeList3 = localElement.getElementsByTagName("ack");
        if (localNodeList3.getLength() == 0)
          return false;
        paramHashtable.put("Ack", a(((Element)localNodeList3.item(0)).getChildNodes()));
        NodeList localNodeList4 = localElement.getElementsByTagName("correlationId");
        if (localNodeList4.getLength() == 0)
          return false;
        paramHashtable.put("CorrelationId", a(((Element)localNodeList4.item(0)).getChildNodes()));
        NodeList localNodeList5 = localElement.getElementsByTagName("build");
        if (localNodeList5.getLength() == 0)
          return false;
        paramHashtable.put("Build", a(((Element)localNodeList5.item(0)).getChildNodes()));
        NodeList localNodeList6 = localDocument.getElementsByTagName("availableAddress");
        if (localNodeList6.getLength() == 0)
          return false;
        Vector localVector = new Vector();
        i = 0;
        if (i < localNodeList6.getLength())
        {
          com.paypal.android.a.a.h localh = new com.paypal.android.a.a.h();
          if (localh.a((Element)localNodeList6.item(i)))
            localVector.add(localh);
        }
        else
        {
          paramHashtable.put("AvailableAddresses", localVector);
          return true;
        }
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        return false;
      }
      i++;
    }
  }

  public static String h(Hashtable paramHashtable)
  {
    String str1 = c.c((String)paramHashtable.get("PayKey"));
    String str2 = PayPalActivity.b.h();
    return "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n<soapenv:Body id=\"_0\">\n<ns2:GetAvailableShippingAddressesRequest xmlns:ns2=\"http://svcs.paypal.com/types/ap\">\n<key>" + str1 + "</key>\n" + "<requestEnvelope>\n" + "<errorLanguage>" + str2 + "</errorLanguage>\n" + "</requestEnvelope>\n" + "</ns2:GetAvailableShippingAddressesRequest>" + "</soapenv:Body>\n" + "</soapenv:Envelope>";
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.paypal.android.a.o
 * JD-Core Version:    0.6.2
 */